/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.util.HashMap;
import javax.swing.ImageIcon;

/**
 *
 * @author Benjamin De Clercq, Michiel Vancoillie, Ruben Slabbinck
 */
public class Pion{

    //Aantallen
    public static final int VLAGGEN = 1;
    public static final int BOMMEN = 6;
    public static final int SPIONNEN = 1;
    public static final int VERKENNERS = 8;
    public static final int MINEURS = 5;
    public static final int SERGEANTEN = 4;
    public static final int LUITENANTEN = 4;
    public static final int KAPITEINEN = 4;
    public static final int MAJOREN = 3;
    public static final int KOLONELLEN = 2;
    public static final int GENERALEN = 1;
    public static final int MAARSCHALKEN = 1;
    

    public static final HashMap<Integer,Integer> LEGER = new HashMap<Integer,Integer >();
    static{
        int j=0;
        for(int i=0;i<Pion.VLAGGEN;i++){
            LEGER.put(j,0);j++;
        }
        for(int i=0;i<Pion.BOMMEN;i++){
            LEGER.put(j,1);j++;
        }
        for(int i=0;i<Pion.SPIONNEN;i++){
            LEGER.put(j,2);j++;
        }
        for(int i=0;i<Pion.VERKENNERS;i++){
            LEGER.put(j,3);j++;
        }
         for(int i=0;i<Pion.MINEURS;i++){
            LEGER.put(j,4);j++;
        }
         for(int i=0;i<Pion.SERGEANTEN;i++){
            LEGER.put(j,5);j++;
        }
         for(int i=0;i<Pion.LUITENANTEN;i++){
            LEGER.put(j,6);j++;
        }
         for(int i=0;i<Pion.KAPITEINEN;i++){
            LEGER.put(j,7);j++;
        }
         for(int i=0;i<Pion.MAJOREN;i++){
            LEGER.put(j,8);j++;
        }
         for(int i=0;i<Pion.KOLONELLEN;i++){
            LEGER.put(j,9);j++;
        }
         for(int i=0;i<Pion.GENERALEN;i++){
            LEGER.put(j,10);j++;
        }
         for(int i=0;i<Pion.MAARSCHALKEN;i++){
            LEGER.put(j,11);j++;
        }
    }


     // Afbeeldingen rode pionnen
    final ImageIcon VLAGROOD = new ImageIcon(getClass().getResource("/resources/FlagR.jpg"));
    final ImageIcon BOMROOD = new ImageIcon(getClass().getResource("/resources/BombR.jpg"));
    final ImageIcon SPIONROOD = new ImageIcon(getClass().getResource("/resources/SpyR.jpg"));
    final ImageIcon VERKENNERROOD = new ImageIcon(getClass().getResource("/resources/ScoutR.jpg"));
    final ImageIcon MINEURROOD = new ImageIcon(getClass().getResource("/resources/MinerR.jpg"));
    final ImageIcon SERGEANTROOD = new ImageIcon(getClass().getResource("/resources/SergeantR.jpg"));
    final ImageIcon LUITENANTROOD = new ImageIcon(getClass().getResource("/resources/LieutenantR.jpg"));
    final ImageIcon KAPITEINROOD = new ImageIcon(getClass().getResource("/resources/CaptainR.jpg"));
    final ImageIcon MAJOORROOD = new ImageIcon(getClass().getResource("/resources/MajorR.jpg"));
    final ImageIcon KOLONELROOD = new ImageIcon(getClass().getResource("/resources/ColonelR.jpg"));
    final ImageIcon GENERAALROOD = new ImageIcon(getClass().getResource("/resources/GeneralR.jpg"));
    final ImageIcon MAARSCHALKROOD = new ImageIcon(getClass().getResource("/resources/MarshalR.jpg"));
    final ImageIcon PIONROOD[] = {VLAGROOD,BOMROOD,SPIONROOD,VERKENNERROOD,MINEURROOD,SERGEANTROOD,LUITENANTROOD,KAPITEINROOD,MAJOORROOD,KOLONELROOD,GENERAALROOD,MAARSCHALKROOD};
    
    // Afbeeldingen blauwe pionnen
    final ImageIcon VLAGBLAUW = new ImageIcon(getClass().getResource("/resources/FlagB.jpg"));
    final ImageIcon BOMBLAUW = new ImageIcon(getClass().getResource("/resources/BombB.jpg"));
    final ImageIcon SPIONBLAUW = new ImageIcon(getClass().getResource("/resources/SpyB.jpg"));
    final ImageIcon VERKENNERBLAUW = new ImageIcon(getClass().getResource("/resources/ScoutB.jpg"));
    final ImageIcon MINEURBLAUW = new ImageIcon(getClass().getResource("/resources/MinerB.jpg"));
    final ImageIcon SERGEANTBLAUW = new ImageIcon(getClass().getResource("/resources/SergeantB.jpg"));
    final ImageIcon LUITENANTBLAUW = new ImageIcon(getClass().getResource("/resources/LieutenantB.jpg"));
    final ImageIcon KAPITEINBLAUW = new ImageIcon(getClass().getResource("/resources/CaptainB.jpg"));
    final ImageIcon MAJOORBLAUW = new ImageIcon(getClass().getResource("/resources/MajorB.jpg"));
    final ImageIcon KOLONELBLAUW = new ImageIcon(getClass().getResource("/resources/ColonelB.jpg"));
    final ImageIcon GENERAALBLAUW = new ImageIcon(getClass().getResource("/resources/GeneralB.jpg"));
    final ImageIcon MAARSCHALKBLAUW = new ImageIcon(getClass().getResource("/resources/MarshalB.jpg"));
    final ImageIcon PIONBLAUW[] = {VLAGBLAUW,BOMBLAUW,SPIONBLAUW,VERKENNERBLAUW,MINEURBLAUW,SERGEANTBLAUW,LUITENANTBLAUW,KAPITEINBLAUW,MAJOORBLAUW,KOLONELBLAUW,GENERAALBLAUW,MAARSCHALKBLAUW};

    final int AANTALSTAPPEN[] = {0, 0, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1};
    
    private int rang;
    // Speler 1 <-> Speler 2
    int speler;
    int aantalStappen;

    public Pion(int rang, int speler) {
        this.rang = rang;
        this.speler = speler;
        this.aantalStappen = AANTALSTAPPEN[rang];
    }

    public int getSpeler() {
        return speler;
    }

    public int getAantalStappen() {
        return aantalStappen;
    }

    public int getRang() {
        return rang;
    }

    public ImageIcon getImageIcon() {
        if (speler == 1) {
            return PIONBLAUW[rang];
        } else {
            return PIONROOD[rang];
        }
    }

    @Override
    public String toString() {
        return Integer.toString(rang);
    }

}
